load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "cophandler",
    srcs = [
        "analyze.go",
        "closure_exec.go",
        "cop_handler.go",
        "mpp.go",
        "mpp_exec.go",
        "topn.go",
    ],
    importpath = "github.com/pingcap/tidb/store/mockstore/unistore/cophandler",
    visibility = ["//visibility:public"],
    deps = [
        "//expression",
        "//expression/aggregation",
        "//kv",
        "//parser/ast",
        "//parser/charset",
        "//parser/model",
        "//parser/mysql",
        "//parser/terror",
        "//sessionctx",
        "//sessionctx/stmtctx",
        "//statistics",
        "//store/mockstore/unistore/client",
        "//store/mockstore/unistore/lockstore",
        "//store/mockstore/unistore/tikv/dbreader",
        "//store/mockstore/unistore/tikv/kverrors",
        "//store/mockstore/unistore/tikv/mvcc",
        "//tablecodec",
        "//types",
        "//util",
        "//util/chunk",
        "//util/codec",
        "//util/collate",
        "//util/mock",
        "//util/rowcodec",
        "//util/timeutil",
        "@com_github_golang_protobuf//proto",
        "@com_github_pingcap_badger//y",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/coprocessor",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_kvproto//pkg/mpp",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@com_github_twmb_murmur3//:murmur3",
        "@org_uber_go_atomic//:atomic",
    ],
)

go_test(
    name = "cophandler_test",
    timeout = "short",
    srcs = [
        "cop_handler_test.go",
        "main_test.go",
    ],
    embed = [":cophandler"],
    flaky = True,
    shard_count = 4,
    deps = [
        "//expression",
        "//kv",
        "//parser/mysql",
        "//sessionctx/stmtctx",
        "//store/mockstore/unistore/lockstore",
        "//store/mockstore/unistore/tikv/dbreader",
        "//store/mockstore/unistore/tikv/mvcc",
        "//tablecodec",
        "//testkit/testsetup",
        "//types",
        "//util/codec",
        "//util/collate",
        "//util/rowcodec",
        "@com_github_pingcap_badger//:badger",
        "@com_github_pingcap_badger//y",
        "@com_github_pingcap_kvproto//pkg/coprocessor",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
